home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: presby.edu!jtbell
- From: jtbell@presby.edu (Jon Bell)
- Subject: Re: How does the c++ compiler handle references?
- Message-ID: <DnJJrL.AAv@presby.edu>
- Date: Thu, 29 Feb 1996 14:18:56 GMT
- References: <4h3ld1$jd1@taco.cc.ncsu.edu>
- Organization: Presbyterian College, Clinton, South Carolina USA
-
- John Kirk Hammond <jkhammon@unity.ncsu.edu> wrote:
- >
- > void test(short &hello)
- > {
- > hello++;
- > }
-
- > Does the compiler do some sort of funky pointer weirdness?
- >Like sending the address of hello instead of the value to test and
- >casting the short parameter in test to a short *? And then
- >treating all uses of the variable hello in test as the dereferenced
- >pointer?
-
- Yup, that's exactly what happens. References are basically pointers that
- you can't change (i.e. point them to something different) and that are
- always implicitly dereferenced.
-
- And what's funky and weird about it? They look just like "var"
- parameters in Pascal to me. :-)
-
- --
- Jon Bell <jtbell@presby.edu> | "The Internet grows hyper-
- Dept. of Physics and Computer Science | bolically, but is usually
- Presbyterian College | described elliptically."
- Clinton, South Carolina USA | -- Dr. Internet
-